import * as vscode from "vscode";
import { get } from "./tools/net";

// 插件被激活
export async function activate(context: vscode.ExtensionContext) {
  const getMessage = (): Promise<string> => {
    return get("https://api.mcloc.cn/words/");
  };
  // 插件被激活时执行
  // console.log('Congratulations, your extension "onetalk" is now active!');
  vscode.window.showInformationMessage(await getMessage());
  // 特定执行函数
  let disposable = vscode.commands.registerCommand("onetalk.talk", async () => {
    vscode.window.showInformationMessage(await getMessage());
  });

  context.subscriptions.push(disposable);
}

// 插件被禁用或卸载
export function deactivate() {}
